Holochain - A Framework For Distributed Applications

ABSTRACT

This disclosure describes a system including nodes communicating according to a relaxed, agent-centric distributed hash table. The system includes a requesting node requesting a value from a target node. The requesting node is associated with a store radius and a query radius based on an agent location of the requesting node. The store radius indicates one or more peer nodes wherein the requesting node has knowledge about the storage content of these peer nodes. The query radius indicates one or more peer nodes wherein the requesting node has connection with these peer nodes.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application claims the benefit of and is entitled to the prioritydate of provisional application 62/858,910, entitled HOLOCHAIN—AFRAMEWORK FOR DISTRIBUTED APPLICATIONS, filed Jun. 7, 2019, and ishereby incorporated in its entirety by reference.

TECHNICAL FIELD

The present disclosure relates generally to distributed computing, andmore particularly to a system for finding and returning connections orcontent from one or more nodes in a sparsely-connected multi-nodecomputing system where no single node has a comprehensive index of nodesor content managed by those nodes.

BACKGROUND

While it is possible to design computing systems that don't use state,many problems—particularly those that are designed to reflect humaninteractions and the physical world—are easier to model when thecomputing system has state.

Traditional software applications manage state by storing all the memoryin a single place, like a filesystem or database. Just like our house orour bank account, these systems only allow a single program to changewhat is stored in the memory. This “single system” state management isintuitive and still the most broadly used system for managing computersystem state. Even when programs were developed using multiple threads,single systems usually either delegate state management to a singlethread, or they use a method of handing off control between differentthreads so that only one thread is “in control” of the state at anygiven time.

The problem with state is that it represents a hidden input to each ofthe functions that rely on it—and it may be changed outside of ourcontrol. For example, we may think that we have a certain amount ofmoney in our bank account. But if someone has stolen our passwords andtaken money out of our account, our record of how much money we have inour account doesn't agree with the bank account's record.

When we think about “real world” state, we have certain things that wetry to control very carefully, like the amount of money in our bankaccount or the location of our things in our house. We have securitysystems that allow us to make sure that the state of these protectedassets doesn't change without us knowing. In the case of our house, wehave locks that make sure that we are the only ones allowed inside tomove around our things. For things like our bank account, we make surethat any transactions that change the balance are approved by us.

Designing Computing Systems with State

While it is possible to design computing systems that don't use state,many problems—particularly those that are designed to reflect humaninteractions and the physical world—are easier to model when thecomputing system has state.

Traditional software applications manage state by storing all the memoryin a single place, like a filesystem or database. Just like our house orour bank account, these systems only allow a single program to changewhat is stored in the memory. This “single system” state management isintuitive and still the most broadly used system for managing computersystem state. Even when programs were developed using multiple threads,single systems usually either delegate state management to a singlethread, or they use a method of handing off control between differentthreads so that only one thread is “in control” of the state at anygiven time.

Distributed Computing

The need to manage state is acute with distributed computing systems. Adistributed computing system is a group of computing systems—frequentlycalled nodes—which work together to maintain a unified or consistentview of the state represented in the system as a whole.

Single system state management is not easily compatible with distributedcomputing. As soon as multiple programs need to interact with the storedstate, all the different programs need to be coordinated. In computingterms, the different programs wanting to interact with the system stateare either “readers” (programs retrieving some stored value from thememory) or “writers” (programs adding to the memory or changing a storedvalue in the memory).

Distributed systems are a generalization of the multi-reader andmulti-writer threaded programs that work on a single computing system.Logically, there is no reason why readers or writers cannot be onseparate physical nodes, communicating via messages. The various nodescooperate to maintain the shared system state.

Distributed systems usually have more resources available to them thansingle systems. This can result in higher performance or higheravailability for distributed systems. But there is a tradeoff:distributed systems are subject to communication-based failures that cancompromise the system. The CAP theorem states that it is impossible fora distributed data store to simultaneously provide more than two out ofthe following three guarantees:

-   -   Consistency: Every read receives the most recent write or an        error.    -   Availability: Every request receives a (non-error)        response—without the guarantee that it contains the most recent        write.    -   Partition tolerance: The system continues to operate despite an        arbitrary number of messages being dropped (or delayed) by the        network between nodes.

The job of a state coordination function is to manage the tradeoffswithin a distributed computing system. These state coordinationfunctions are used to achieve the best possible consistency,availability, and partition tolerance possible, while mitigating orreducing the number of failures.

The job of a state coordination function is to manage the tradeoffswithin a distributed computing system. These state coordinationfunctions are used to achieve the best possible consistency,availability, and partition tolerance possible, while mitigating orreducing the number of failures.

Representing State

Before discussing various state coordination functions, it is helpful tothink about how state is stored. Within a computing system, any sort ofstorage organization system can be used to maintain state, includingordered/unordered flat files, ISAM, heap files, hash buckets, B+ trees,logs, and log-structured merge trees. A state storage engine may alsohave many layers, each operating under different principles. Carefulattention to how the state is stored and manipulated, however, makes iteasier to make guarantees about the correctness of the data.

Different types of state storage may be mutable or immutable. A mutablestorage can have its records modified. An immutable storage can only addinformation to the storage; previously written information cannot bechanged.

Many common mutable data storage engines use a relational structure. Arelational database organizes data into one or more tables (or“relations”) of columns and rows, with a unique key identifying eachrow. The data can be “normalized” to ensure that each piece ofinformation is stored in exactly one place. In a normalized relationaldatabase, all changes to the stored state can be expressed in terms ofan ordered set of create, read, update, and delete statements, eachacting on a specified domain and range within each relation. An orderedset of these state-modifying statements, applied together, is referredto as a transaction. If the transaction applies completely, or not atall, then the transaction is atomic.

Relational databases are flexible, supporting ad-hoc querying andupdates to the stored data. But the strict data typing and referentialcontrols necessary to support such flexibility also make relationaldatabases hard to effectively scale up to respond to many readers andwriters. If there is only one place where a particular piece of data isstored, then access to a particular piece of information may be abottleneck, reducing availability.

Some databases address this issue by denormalizing (storing the data inmore than one place) or using alternative, non-relational datastructures. These databases, sometimes called “NoSQL databases,” relaxthe data type, data organization, or referential controls commonly foundin relational databases in order to achieve better availability,partition tolerance, or performance, at the cost of reduced consistency.These NoSQL data storage engines are also examples of mutable datastores.

Alternatively, a data storage engine can have immutable storage. Forexample, one type of immutable storage engine uses a log-structuredstorage engine. A log is an append-only, ordered sequence of recordsordered by time. Changes to the system state are recorded as atomicchanges in the log. At any time, the system state is defined by theordered set of changes recorded in the log. If two nodes have the samecontents in their state logs, then their states are consistent.

One alternative to totally-ordered log-based state storage is the use ofadditive data structures such as conflict-free replicated data types(CRDTs). CRDTs are data types that can be applied in any order bydifferent nodes, and the end result will be consistent. This means thatCRDT-based state storage has high availability and high partitiontolerance, but low immediate consistency. CRDTs provide strong eventualconsistency, so long as the disparities between different data storescan be tolerated during the period when replicas may be inconsistent.All nodes that have “merged” all the data structure changes, regardlessof the order in which the changes are presented, are guaranteed to be ina consistent state.

Hash Chains

One important type of immutable storage is a hash chain or hash tree(sometimes called “blockchains” or “Merkle trees,” respectively). Hashchains are data structures in which each record contains bothinformation to be stored, one or more update rules, and a securecryptographic hash of the immediately preceding record. Because eachrecord includes the preceding hash, recursively to the start of the datastructure, anyone receiving a copy of the data structure canindependently verify the integrity of the entire record by applying theupdate rules to the stored data and calculating the appropriate hashes.This makes a hash chain or hash tree effectively immutable, even if itstored in a mutable storage, because any changes to the data invalidatethe cryptographic hashes embedded in the chain.

State Coordination Functions

State coordination functions can generally be categorized as one of twotypes—either centralized or decentralized. Decentralized statemanagement can further be divided into distributed state storage anddistributed state management.

Distributed Systems, Centralized State

Systems with centralized state management have a designated center pointby which and through which decisions for the entire system are made. Toallow multiple independent programs to change the contents of thememory, there are protocols that ensure that each writer is authorizedto make its changes and that the changes are made in a careful way thatprevents conflicts and makes sure that all the readers see a consistentpicture. Common state update protocols include two phase commit andthree phase commit, both of which are frequently used in databases.

But these protocols are used to coordinate multiple programs interactingwith the stored state—but the state is still primarily maintained in oneplace. The nodes might be distributed, but the state is centralized. Interms of the CAP theorem, distributed systems with centralized statemanagement have high consistency and high partition tolerance, but loweravailability. The central management node can be a bottleneck due to allstate management needing to go through that single node, and it isdifficult for distributed system to deal with the loss of the node whichimplements the state management function.

Distributing State Storage

One response to the problem of centralized state is to distribute thestate across more than one node. In a distributed state storage system,the state—the memory—is either sharded, replicated, or both.

Sharding

In a sharded system, parts of the system state are stored on and managedby different nodes in the system. If a process needs to either read orstore a value in the shared state, it first identifies a sharding keyallows it to identify which node is storing and managing that particularpart of the system state. The process then interacts with the nodemanaging that part of the system state to read or write the valueaccordingly.

The advantage of a sharded system is that no single node is responsiblefor updating or storing all of the state associated with the system.This means that the load associated with state management can be spreadout across the distributed system. Further, if a single node goes down,then only the fraction of the state managed by that node becomesunavailable. In terms of the CAP theorem, a sharded system is equivalentto a system with centralized state, but the chance that availabilitywill be compromised by the loss of a node is 1/n, where n is the numberof different nodes participating in the sharded state storage.

Replication

In a replicated system, some or all of the system state is duplicatedacross one or more nodes. The state may be completely duplicated, suchfor a database with a standby node, or it may be partially replicated.Updates made on one copy are communicated to the various replicas. Theseupdates are usually distributed using one or more of transactionalreplication, state machine replication, or virtual synchrony.

Transactional replication refers to a model where each update isequivalent to the serialized stream of changes applied during thatupdate. For example, a transaction log can be used to implementtransactional replication between two nodes.

State machine replication is a process by which the changes and thestate of the system are jointly represented as a closed set of changesthat can be applied to each node. Hash chains and CRDTs can be used toimplement state machine replication.

Virtual synchrony involves a group of processes which collectively workin tandem to create a replicated state. Not every node needs toparticipate; smaller groups of nodes are organized into process groups.Nodes join a group and are provided with a checkpoint containing thecurrent state of the data replicated by group members. Nodes then sendmulticasts to the group and see incoming multicasts in the identicalorder. Membership changes are handled as a special multicast thatdelivers a new “membership view” to the nodes in the group.

Coordinating State Updates

Depending on the state management function, updates to the shared statemay be performed on only one of the copies, the “master,” or on anycopy. If updates can only be made to the master copy, then the systemhas centralized state with recovery to another node. If more than onenode can receive updates to the common system state, then some type ofdistributed state management is required.

Some of the state replication methods identified above can also be usedto implement a distributed state management function. In particular,state machine replication assumes that the replicated process is adeterministic finite automaton and that atomic broadcast of every eventis possible.

Consensus Algorithms

A distributed state management algorithm is also known as a consensusalgorithm. A consensus algorithm is one that allows different nodes toagree on a particular value in the shared state. Examples ofapplications of consensus include whether to commit a transaction to adatabase, agreeing on the identity of a leader, state machinereplication, and whether to add a particular record to a hash chain.Examples of well-known consensus algorithms include Paxos and Raft.

Consensus algorithms are designed to be resilient in the presence ofnetwork failures and changed messages. In general, consensus algorithmshave the following properties:

-   -   Termination: Eventually, every correct process decides some        value.    -   Integrity: If all (or some specified number of)        correctly-operating participants propose the same value v, then        the outcome of the process must equal v.    -   Agreement: Every correct process must agree on the same value.

To achieve this result, most consensus algorithms take one of twoapproaches. In the first approach, there is a deterministic process forelecting one of the participating nodes to be a “leader.” The leaderdetermines the correct state value and communicates it to the othernodes. A leader-based approach also includes rules for handling failureof the leader node and network splits that result in inconsistent leaderelections.

A second approach for consensus algorithms uses concurrent computationand comparison. In a concurrent computation and comparison approach,each participating node is able to compute and propose a new statevalue. If some number of participating nodes agree—usually amajority—then the new state value is accepted as the correct value.

Byzantine Fault Tolerance

Some consensus protocols are also designed to deal with some number offaulty or malicious nodes participating in the network. Protocols thatare designed to be robust against faulty or malicious nodes are said tohave “Byzantine Fault Tolerance,” named for the paper that introducedthe concept. Byzantine Fault Tolerant (BFT) systems either include anumber of message rounds between node participants, verifying stateinformation, or they are built upon unforgeable message signatures, suchas digital signatures.

Content and Node Addressing

One problem not discussed above is the problem of addressing: when statevalues are being replicated, or consensus messages are being exchanged,each node needs to know how to reach other nodes participating in thedistributed system.

The simplest way to handle addressing is for all nodes to have a list ofother participating nodes, or to have a known “name node” that keepstrack of the address information for all participating nodes. This is asolution for systems where the number of nodes is known, and where nodeslike the name node can be trusted. But if nodes cannot necessarily betrusted, or if nodes are transient, a different solution can be used: adistributed hash table, or DHT.

A hash table is a data structure that associates keys to values. Valuesare stored in the data structure according to a hash function thatcomputes an index into a possible array of storage buckets, whichthemselves provide the value. A distributed hash table performs the samefunction across more than one node. Any participating node canefficiently retrieve the value associated with a given key.Responsibility for maintaining the mapping from keys to values isdistributed among the nodes, in such a way that a change in the set ofparticipants causes a minimal amount of disruption. This allows a DHT toscale to extremely large numbers of nodes and to handle continual nodearrivals, departures, and failures. The particular hash function used ischosen minimize changes in lookup values when the number of participantschanges. The four most popular approaches are rendezvous hashing,consistent hashing, the content addressable network algorithm, andKademlia distance. It is not always necessary that all possible valuesbe stored in the DHT; in some cases it may be enough to have a sharedformula by which a value can be calculated from a particular key.

For example, a Kademlia DHT works by specifying the structure of thenetwork and the exchange of information through node lookups. Kademlianodes communicate among themselves using User Datagram Protocol (UDP). Avirtual or overlay network is formed by the participant nodes. Each nodeis identified by a number or node ID. The node ID serves not only asidentification, but the Kademlia algorithm uses the node ID to locatevalues. When searching for some value, the algorithm takes theassociated key and explores the network in several steps. Each step willfind nodes that are closer to the key until the contacted node returnsthe value or no more closer nodes are found. When the closest nodes arefound, they are returned to the requester.

Existing Systems

The most well-known hash chain application is “Bitcoin,” a hashchain-based cryptocurrency ledger. In the context of the systems above,Bitcoin is a distributed system with an immutable replicated state builton a hash chain. Bitcoin uses a Byzantine Fault Tolerant consensusalgorithm to coordinate transactions.

Specifically, the bitcoin blockchain is a public ledger that recordsbitcoin transactions between members of the network. It is implementedas a chain of blocks, each block containing a hash of the previous blockup to the genesis block of the chain. Network nodes can validatetransactions, add them to their copy of the ledger, and then broadcastthese ledger additions to other nodes. To achieve independentverification of the chain of ownership each network node stores its owncopy of the blockchain.

A network of communicating nodes running bitcoin software maintains theblockchain by “mining,” that is, running a lottery-like process ofdetermining a random hash value that meets a set of acceptance rules.About every 10 minutes, when an acceptable hash value is found, a newgroup of accepted transactions, called a block, is created, added to theblockchain, and quickly published to all nodes.

Sometimes separate blocks are produced concurrently, creating atemporary fork. In addition to the immutable history, participants inthe blockchain have an algorithm for scoring different versions of thehistory so that the history with the highest value can be selected overothers. Peers supporting the database have different versions of thehistory from time to time. They keep only the highest-scoring version ofthe database known to them. Whenever a peer receives a higher-scoringversion (usually the old version with a single new block added) theyextend or overwrite their own database and retransmit the improvement totheir peers. There is never an absolute guarantee that any particularentry will remain in the best version of the history, but the sharedconcurrent computation rules award a higher value to adding new blocksthan replacing old blocks. Therefore, the probability of an entrybecoming superseded decreases exponentially as more blocks are built ontop of it, eventually becoming very low.

Another type of distributed and decentralized system is used to managesource code control and updates. Two similar systems are called Git andMercurial. Git and Mercurial are a distributed version-control systemused to track changes in source code for use in software development.The files and changes to the files are organized as a Merkle tree,guaranteeing that the complete state of the version controlled files isconsistent. In addition, each change has a unique cryptographic address,allowing individual commits to be selectively addressed.

Git and Mercurial each include a mutable index (also called stage orcache) that caches information about the working directory and the nextrevision to be committed; and an immutable, append-only object database.The object database represents the accepted state of the system. Theobject database contains four types of objects:

-   -   A blob object (binary large object) is the content of a file.        Blobs have no proper file name, time stamps, or other metadata.        (A blob's name internally is a hash of its content.)    -   A tree object is the equivalent of a directory. It contains a        list of file names, each with some type bits and a reference to        a blob or tree object that is that file, symbolic link, or        directory's contents. These objects are a snapshot of the source        tree.    -   A commit object links tree objects together into a history. It        contains the name of a tree object (of the top-level source        directory), a time stamp, a log message, and the names of zero        or more parent commit objects    -   A tag object is a container that contains a reference to another        object and can hold added metadata related to another object.

When a developer commits a new revision, the temporary information isadded to the accepted state. Git and Mercurial provide each developer alocal copy of the entire state, and provides a mechanism for exchangingcommits (state changes) between different repositories. There is nouniversal addressing, but different repository signatures are maintainedas they are merged. Thus the entire distributed source control mechanismcan be seen as a distributed state consensus mechanism with periodicreconciliation between participating nodes.

Freenet is another decentralized and distributed system used forcensorship-resistant communication. It uses a decentralized distributeddata store to keep and deliver information. Technically, it functions ascontent-addressed system paired with a distributed hash table.Typically, a host computer on the network runs the software that acts asa node, and it connects to other hosts running that same software toform a large distributed, variable-size network of peer nodes. Somenodes are end user nodes, from which documents are requested andpresented to human users. Other nodes serve only to route data. Allnodes communicate with each other identically—there are no dedicated“clients” or “servers”. It is not possible for a node to rate anothernode except by its capacity to insert and fetch data associated with akey. Keys are hashes, and so nodes can check that the document returnedis correct by hashing it and checking the digest against the key.

Content Addressing and Discovery

Returning to the concept of addressing, distributed systems generallyneed a mechanism for discovery—that is, finding other nodes in thenetwork based upon some criteria. A number of existing technologiespresent different methods of organizing clients so that they can befound without resorting to a single central directory. These includeChord, Hypercubes, and Kademlia (discussed previously).

4.1 Chord

FIG. 1 shows an exemplary 16-node chord network 100. In chord network110, as nodes 105(1)-(16) come online they distinguish their positionwithin the ring based on their identity. These nodes 105(1)-(16)identify themselves to the nodes immediately in front of and behindthemselves, and become a part of the ring chain. For example, node105(2) identifies itself to 105(3) (“successor”) and nodes 105(1)(“predecessor”)—the nodes immediately in front of and behind node 105(2)in a clockwise direction, respectively. As nodes 105(1)-(16) go offline,they try to notify their connections, but in the case of failure, theirconnections will notice the lack of connectivity and relink themselves.

Discovery requires messaging the closest node in the “finger list”, forexample, the successor, then messaging the closest node in their “fingerlist” and so on.

4.2 HyperCube

FIG. 2 shows an exemplary 2-level HyperCube 200. In level 2, each nodenot only has sibling nodes but also a parent node. For example, whennode 205 comes online, it connects with three siblings and one parent:nodes 210, 215, 220 and 225. In HyperCube, as nodes come online, theysimply take the next space in the tree structure. As nodes leave,vacancies are created that can be filled by future arriving nodes. Inthe dire case of too many nodes leaving, the existing nodes canreorganize.

Discovery is a fairly straight-forward navigation question once theeffectively randomly assigned position identifier of a node are known.

4.3 Kademlia

In Kademlia, nodes are organized into “k-buckets” according to thebinary digits of their identity. For example, the exemplary Kademlianetwork 300 includes 7 nodes 305(1)-(7), as shown by the dots at thebottom in FIG. 3. Assuming node 310(6) (with index “110”) is the targetnode to be searched for, the remaining nodes 305(1-5) and 310(7) arepeer nodes organized in 3 k-buckets 310(1)-(3), respectively, as shownby the larger circles. The “distance” as measured by the exclusive or(XOR) of two identities determines the relative closeness of anothernode, and a lopsided binary tree effectively means that references aremaintained to more nodes closer to the target identity than thosefurther away. For example, nodes 305(1)-(3) in k-bucket 310(1) are thefarthest nodes away from target node 305(6), while node 305(7) ink-bucket 310(3) is the nearest node.

Discovery requires making a query to a node that is known about as closeto the target identity as possible (based on the XOR “distance”). Thatnode should theoretically have references to more nodes in thatparticular neighborhood and can get closer to the target identity. Thediscovery repeats until the contacted node returns identity of thetarget node (i.e., the target node is being found) or no more closernodes are found.

As described above, values can be stored in a data structure using ahash table. The hash table associates keys to values. Given a key, thehash table computes a corresponding index according to a hash functionthat in turn points to the value stored in an array. Locating a value ina Kademlia network follows the same procedure by locating the closestnodes to a key or index, and the search terminates when a node has therequested value in its store and returns this value.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the disclosed concepts are illustrated by way ofexample and not by way of limitation in the accompanying drawings inwhich like references indicate similar elements. It should be noted thatreferences to “some” embodiments in this disclosure mean at least oneembodiment and they are not necessarily the same or differentembodiments. To be concise, drawings may be used to facilitatedescriptions of exemplary embodiments, and not all features of an actualimplementation may be provided in the drawings.

FIG. 1 shows an exemplary chord network.

FIG. 2 shows an exemplary HyperCube.

FIG. 3 shows an exemplary Kademlia network.

FIG. 4 shows an exemplary information processing system.

FIG. 5 shows the basic architecture of an exemplary holochain.

FIG. 6 shows the structure of an exemplary source chain.

FIG. 7 shows the operation of an exemplary holochain application.

FIG. 8 shows an exemplary Holochain network according to someembodiments.

FIG. 9 shows an exemplary discovery process in a Holochain networkaccording to some embodiments.

DETAILED DESCRIPTION

This disclosure describes a distributed system made up of a plurality ofindividual computing systems, each referred to as a “node.” Referringnow to FIG. 4, diagram 400 shows an information processing system 410which may function as a node, coupled to a network 405. The network 405could be any type of network, for example, wired network, wirelessnetwork, a private network, a public network, a local area network(LAN), a wide area network (WAN), a wide local area network (WLAN), acombination of the above, or the like. The network may also be a virtualnetwork, such as an overlay or underlay network. In some embodiments,the network may operate on more than one level such that connectionsbetween nodes are virtually addressed or content addressed. Aninformation processing system is an electronic device capable ofprocessing, executing or otherwise handling information. Examples ofinformation processing systems include a server computer, a personalcomputer (e.g., a desktop computer or a portable computer such as, forexample, a laptop computer), a handheld computer, and/or a variety ofother information handling systems known in the art. The informationprocessing system 410 shown is representative of, one of, or a portionof, the information processing systems described above.

The information processing system 410 may include any or all of thefollowing: (a) a processor 412 for executing and otherwise processinginstructions, (b) one or more network interfaces 414 (e.g., circuitry)for communicating between the processor 412 and other devices, thoseother devices possibly located across the network 405; (c) a memorydevice 416 (e.g., FLASH memory, a random access memory (RAM) device or aread-only memory (ROM) device for storing information (e.g.,instructions executed by processor 412 and data operated upon byprocessor 412 in response to such instructions)). In some embodiments,the information processing system 410 may also include a separatecomputer-readable medium 418 operably coupled to the processor 412 forstoring information and instructions as described further below.

In one embodiment, there is more than one network interface 414, so thatthe multiple network interfaces can be used to separately routemanagement, production, and other traffic. In one exemplary embodiment,an information processing system has a “management” interface at 1 GB/s,a “production” interface at 10 GB/s, and may have additional interfacesfor channel bonding, high availability, or performance. An informationprocessing device configured as a processing or routing node may alsohave an additional interface dedicated to public Internet traffic, andspecific circuitry or resources necessary to act as a VLAN trunk.

In some embodiments, the information processing system 410 may include aplurality of input/output devices 420 a-n which are operably coupled tothe processor 412, for inputting or outputting information, such as adisplay device 420 a, a print device 420 b, or other electroniccircuitry 420 c-n for performing other operations of the informationprocessing system 410 known in the art.

With reference to the computer-readable media, including both memorydevice 416 and secondary computer-readable medium 418, thecomputer-readable media and the processor 412 are structurally andfunctionally interrelated with one another as described below in furtherdetail, and information processing system of the illustrative embodimentis structurally and functionally interrelated with a respectivecomputer-readable medium similar to the manner in which the processor412 is structurally and functionally interrelated with thecomputer-readable media 416 and 418. As discussed above, thecomputer-readable media may be implemented using a hard disk drive, amemory device, and/or a variety of other computer-readable media knownin the art, and when including functional descriptive material, datastructures are created that define structural and functionalinterrelationships between such data structures and thecomputer-readable media (and other aspects of the system 400). Suchinterrelationships permit the data structures' functionality to berealized. For example, in one embodiment the processor 412 reads (e.g.,accesses or copies) such functional descriptive material from thenetwork interface 414, the computer-readable media 418 onto the memorydevice 416 of the information processing system 410, and the informationprocessing system 410 (more particularly, the processor 412) performsits operations, as described elsewhere herein, in response to suchmaterial stored in the memory device of the information processingsystem 410. In addition to reading such functional descriptive materialfrom the computer-readable medium 418, the processor 412 is capable ofreading such functional descriptive material from (or through) thenetwork 405. In one embodiment, the information processing system 410includes at least one type of computer-readable media that isnon-transitory. For explanatory purposes below, singular forms such as“computer-readable medium,” “memory,” and “disk” are used, but it isintended that these may refer to all or any portion of thecomputer-readable media available in or to a particular informationprocessing system 410, without limiting them to a specific location orimplementation.

The information processing system 410 may include a container manager430. The container manager is a software or hardware construct thatallows independent operating environments to coexist on a singleplatform. In one embodiment, the container manager is a hypervisor. Inanother embodiment, the container manager is a software isolationmechanism such as Linux cgroups, Solaris Zones, or similar. Thecontainer manager 430 may be implemented in software, as a subsidiaryinformation processing system, or in a tailored electrical circuit or assoftware instructions to be used in conjunction with a processor tocreate a hardware-software combination that implements the specificfunctionality described herein. To the extent that software is used toimplement the hypervisor, it may include software that is stored on acomputer-readable medium, including the computer-readable medium 418.The container manager may be included logically “below” a host operatingsystem, as a host itself, as part of a larger host operating system, oras a program or process running “above” or “on top of” a host operatingsystem. Examples of container managers include Xenserver, KVM, VMware,Microsoft's Hyper-V, and emulation programs such as QEMU, as well assoftware isolation mechanisms such as jails, Solaris zones, and Dockercontainers.

The container manager 430 includes the functionality to add, remove, andmodify a number of logical containers 432 a-n associated with thecontainer manager. Zero, one, or many of the logical containers 432 a-ncontain associated operating environments 434 a-n. The logicalcontainers 432 a-n can implement various interfaces depending upon thedesired characteristics of the operating environment. In one embodiment,a logical container 432 implements a hardware-like interface, such thatthe associated operating environment 434 appears to be running on orwithin an information processing system such as the informationprocessing system 410. For example, one embodiment of a logicalcontainer 434 could implement an interface resembling an x86, x86-64,ARM, or other computer instruction set with appropriate RAM, busses,disks, and network devices. A corresponding operating environment 434for this embodiment could be an operating system such as MicrosoftWindows, Linux, Linux-Android, or Mac OS X. In another embodiment, alogical container 432 implements an operating system-like interface,such that the associated operating environment 434 appears to be runningon or within an operating system. For example one embodiment of thistype of logical container 432 could appear to be a Microsoft Windows,Linux, or Mac OS X operating system. Another possible operating systemincludes an Android operating system, which includes significant runtimefunctionality on top of a lower-level kernel. A corresponding operatingenvironment 434 could enforce separation between users and processessuch that each process or group of processes appeared to have soleaccess to the resources of the operating system. In a third environment,a logical container 432 implements a software-defined interface, such alanguage runtime or logical process that the associated operatingenvironment 434 can use to run and interact with its environment. Forexample one embodiment of this type of logical container 432 couldappear to be a Java, Dalvik, Lua, Python, or other language virtualmachine. A corresponding operating environment 434 would use thebuilt-in threading, processing, and code loading capabilities to loadand run code. Adding, removing, or modifying a logical container 432 mayor may not also involve adding, removing, or modifying an associatedoperating environment 434.

In one or more embodiments, a logical container has one or more networkinterfaces 436. The network interfaces (NIs) 436 may be associated witha switch at either the container manager or container level. The NI 236logically couples the operating environment 434 to the network, andallows the logical containers to send and receive network traffic. Inone embodiment, the physical network interface card 414 is also coupledto one or more logical containers through a switch.

In one or more embodiments, each logical container includesidentification data for use naming, interacting, or referring to thelogical container. This can include the Media Access Control (MAC)address, the Internet Protocol (IP) address, and one or more unambiguousnames or identifiers.

In one or more embodiments, a “volume” is a detachable block storagedevice. In some embodiments, a particular volume can only be attached toone instance at a time, whereas in other embodiments a volume works likea Storage Area Network (SAN) so that it can be concurrently accessed bymultiple devices. Volumes can be attached to either a particularinformation processing device or a particular virtual machine, so theyare or appear to be local to that machine. Further, a volume attached toone information processing device or VM can be exported over the networkto share access with other instances using common file sharingprotocols. In other embodiments, there are areas of storage declared tobe “local storage.” Typically a local storage volume will be storagefrom the information processing device shared with or exposed to one ormore operating environments on the information processing device. Localstorage is guaranteed to exist only for the duration of the operatingenvironment; recreating the operating environment may or may not removeor erase any local storage associated with that operating environment.

In a distributed system involving multiple nodes, each node will be aninformation processing system 410 as described above in FIG. 4. Theinformation processing systems in the distributed system are connectedvia a communication medium, typically implemented using a known networkprotocol such as Ethernet, Fibre Channel, Infiniband, or IEEE 1394. Thedistributed system may also include one or more network routing element,implemented as hardware, as software running on hardware, or may beimplemented completely as software. In one implementation, the networkrouting element is be implemented in a logical container 432 using anoperating environment 434 as described above. In another embodiment, thenetwork routing element is implemented so that the distributed systemcorresponds to a group of physically co-located information processingsystems, such as in a rack, row, or group of physical machines.

The network routing element allows the information processing systems410, the logical containers 432 and the operating environments 434 to beconnected together in a network topology. The illustrated tree topologyis only one possible topology; the information processing systems andoperating environments can be logically arrayed in a ring, in a star, ina graph, or in multiple logical arrangements through the use of vLANs.

In one embodiment, one or more nodes acts as a controller to administerthe distributed system. The controller is used to store or provideidentifying information associated with the different addressableelements in the distributed system—specifically the cluster networkrouter (addressable as the network routing element), each informationprocessing system 410, and with each information processing system theassociated logical containers 432 and operating environments 434.

In one embodiment, the distributed system including the componentsdescribed above is organized as a Holochain network. A Holochain networkis a distributed system with content-addressed nodes, where identities,nodes, and storage elements are all addressed by cryptographic hashvalues. Distributed applications run across multiple nodes in thenetwork and the Holochain network is organized to provide adecentralized state coordination function so as to protect the integrityand functionality of the distributed, decentralized applications runningon the network.

In a Holochain network, multiple individual hash chains are used tocoordinate state between the various agents and the various nodes. Eachhash chain is a ledger of records organized in “blocks.” Each block inthe hashchain may comprise a header and data (or “content”) wherein thedata may include information about a list of transactions, for example.Each block may be identified by a key such as a block hash, usually aunique number for each block generated using a cryptographic hashingalgorithm on the header of the block. The header itself may have one ormore fields storing metadata. The metadata may include, for example, theblock hash of the previous block (or “parent block”), a root, and atimestamp. The block hash of the parent block (or “previous block hash”)may again be generated using a cryptographic hashing algorithm on theheader of the parent block. Because each block contains a previous blockhash, the sequence of hashing linking each block to its parent blockcreates a chain going back all the way to the first block created (or“genesis block”). The root in the metadata of each block may provide asummary of the data in the block. In this fashion, a hash chain isconceptually similar to a Merkle tree, but one with a limited branchingfactor.

The above described layered relationships between header, root and data,and between child and parent blocks can ensure data integrity in ablockchain. For example, when the data of a block is modified in anyway, including changes to the block metadata, the hash value of theblock changes. Because each subsequent block in a hash chain recursivelydepends upon the values in previous blocks, any subsequent blocks mustalso have their hash values updated or the chain will be “forked,” withnew values based on the new block hash value. Thus, any change in anyblock, from the root up to any intermediate block, will immediately beapparent upon inspection.

A Holochain network is designed as a framework to tackle the abovedescribed challenges and provide data integrity for distributed,decentralized applications. A Holochain application (i.e., theapplication running on a Holochain platform or HApp) may comprise anetwork of nodes (or “agents”), each maintaining a unique source chainof its local data, paired with a shared space implemented as avalidating, monotonic, sharded, distributed hash table (DHT), whereevery node enforces validation rule(s) on data in the shared DHT as wellas confirms provenance of the data according to an associated signature.Unlike prior art hash chains, such as the blockchain associated withBitcoin, which rely on global consensus around a single shared chainencoding the entire state of the system, a Holochain network includes aseparate hash chain for each discrete HApp (including each version ofeach HApp). To coordinate state, individually interested nodes agree ona state modification function and the hashable result of thecoordination of the two private shared states. The shared DHT spaceallows the coordinating nodes to deterministically identify other nodesthat can record and verify the particulars of each state update. These“witness” nodes are spread psuedorandomly throughout the entire sharedspace, based upon a verifiable calculation distributing the witnessnodes throughout the DHT using the hash of previous states as keyinputs. Thus, only those who are interested in one particular set oftransactions maintain the entire chain of state, but interactions withthe states of other chains are coordinated and “witnessed” so that eachchain of transactions can be validated back to the root, while stillonly requiring each participating node to share state with only alimited number of nodes. By analogy, a Holochain network can beanalogized to real-world state updates, and an individual state updateas a money transfer from A to B. Money can be transferred withvalidations from only A, B and a bank (as a “witness”). It does notrequire a consensus—a global agreement—from all the customers becausethey are not engaged in the transaction at all.

By eliminating the reliance on a global ledger, Holochain provides atruly decentralized application platform with actual self-governance andmutual sovereignty. On the other hand, by still using source chains toenforce data integrity, a Holochain may function very much like ablockchain without bottlenecks when it comes to enforcing a validationrule, but may be designed to be fully distributed through sharding soeach node only needs to maintain one or more portions of the shared DHTinstead of a full copy of a global ledger. This makes it feasible to runblockchain-like applications on devices as lightweight as portabledevices, such as mobile phones.

FIG. 5 shows a basic architecture of exemplary Holochain 500. Holochain500 may include three main sub-systems—HApp 505, source chain 510, andshared DHT 515. HApp 505 coordinates the system to present consistentapplication functionality to a user or agent. HApp 505 may read andwrite local source chain 510, and it may also get data from and putauthorized data onto shared DHT 515. HApp 505 includes validation rulesfor changing its local hash chain. Holochain 500 also includes othernodes connected to HApp 505 to provide independent system-levelvalidation for changes proposed to be entered by HApp 505. HApp 505 maybe a computer application running on Holochain 500. HApp 505 may beaccessed, for instance, with a web browser for a user interface.Application 505 may be implemented using various programming tools, forinstance, JavaScript, Lisp, Python or Go.

In Holochain 500, each node may have a local private space, like a localrepository, for storing data (or “content”). For example, incollaborative software development, the data may be one or more codingfiles. Each node may be required to maintain an individual source chain510. Source chain 510 may be achieved by a hash chain, like blockchain.For example, source chain 510 may comprise one or more blocks. Eachblock may be identified by a key, such as a block hash, usually a uniquenumber for each block which may be created by hashing the header of theblock. The header may include one or more fields storing metadata. Themetadata may include, for instance, a previous block hash of the parentblock, a root, and a timestamp. Like blockchain, the sequence of hashingbetween the child and parent creates a linked chain all the way back tothe genesis block. In the example of collaborative software development,each block may be associated with one version of coding files. When HApp505 carries out an action on the files, for instance, a file addition,deletion or change of content, a new version of the source chain iscreated. Accordingly, a new block may be provided including a new rootwhich summarizes the action and new files. The action and new files maybe validated based on a local validation rule before the new files arecommitted to the local repository and the new block is added to sourcechain 510. When the node shares the data, the node may publish aconcomitant source chain 510 with a signature, which may be providedusing a public-key encryption. Source chain 510 may be shared with agroup of selected nodes selected using the shared DHT as describedbelow. Each selected node may further add new block(s) to source chain510 to capture their subsequent, respective actions on the same data.For example, node A may create software version 1.0 with a first blockin source chain 510. The first block may summarize the data in version1.0 with A's actions. Node A may add its signature, perform avalidation, commit the software to A's local repository, and share thesoftware with node B. Node B may next take the software, develop it toversion 2.0, and update source chain 510 with a second block. The secondblock may summarize the data in version 2.0 with B's actions. Node B maythen add its signature, complete the validation, commit the software toB's local repository, and pass the software onto a next node. Thedescribed operations may continue with the data sharing across Holochain500. Along the process, source chain 510 may provide a verifiabletamper-proof track of data, while the signature may allow a verificationof the data provenance.

FIG. 6 shows an exemplary structure of source chain 510. In FIG. 6,local source chain 510 may include blocks 605-620, wherein block 605 isthe genesis block. Each block 605-620 may include a header and data (notshown in FIG. 6). As described, the header of each block 605-620 mayinclude one or more fields with metadata. For example, block 605 maycomprise header0, which may include one or more fields having metadatasuch as a timestamp (indicating the time when block 605 is created), anentry hash (e.g., the root), an entry type (e.g., addition, deletion ormodification of the data), an entry signature (e.g., the signature ofthe node creating block 605), a previous header (e.g., the previousblock hash), a Holochain ID, and the state modification rules applyingto the HApp (the HApp “DNA”). Header0 may be hashed to create a blockhash or an identifier of block 605.

Similarly, block 610 may also include a header and data (not shown inFIG. 6). The header of block 610 may further include metadata in one ormore fields. The metadata of block 610 may comprise a timestamp, anentry hash, an entry type, an entry signature, and a previous header. Inparticular, the entry hash of block 610 may include a user key, whichmay be a hashed value of a data structure including ID in this groupcontext, public key and ID descriptors. The foregoing process mayrepeat, for example, creating blocks 615 and 620, for each individualaction and new data committed to the local repository.

Holochain is agent-centric because each node may share data with othernodes autonomously as wished without the need for a consensus from theentire system. To ensure data integrity, each entry may need to be firstverified locally by the node—the source of data where it originates—andnext validated at the system-level by a set number of other nodesidentified through the shared DHT 515. The local validation may be usedto ensure the structural validity of the local data. The localvalidation may be performed by each entity proposing a state update. Inthe case of a coordinated state update, like a transfer of informationor credit from one HApp instance to another, all participatingcoordinating HApp instances all perform equivalent local validationsusing the state update functions described in the HApp “DNA” rulesencoded into the application hash chain by HApp 505. Each entity shouldreach an identical new state, as validated by comparisons of the hashedvalues of the updated state and all previous hash chain state afterapplying the state update function. In addition, one or more nodeschosen from the DHT also follow the same update rule and store theresult. After the local validation, node A may add its signature, andpublish the new entry to shared DHT 515 by sharing the data andconcomitant source chain 510 with other nodes.

Shared DHT 515 is a monotonic ledger because any entry added may nolonger be deleted. Instead, it may only be tagged with a “deleted”marker, which does not actually delete the entry but rather only allowsit to be ignored. Shared DHT 515 may further be considered to reside ata “public space” because it is not located at the private space of onespecific node. Instead, shared DHT 515 may comprise all of the publishedsource chains (as a monotonic ledger) and be held collectively by all ofthe nodes on Holochain 500. Unlike blockchain, each node may need tocarry only one or more portions (or shards) of shared DHT 515 instead ofa full copy of the entire ledger. In contrast to prior art blockchainsystems, no node and no agent needs to hold all or even most of theledger. In this distributed manner, each node may be responsible tomaintain its own data and concomitant source chain 510 and be ready toprovide them to other nodes for confirmation, when asked. In addition,all nodes may be responsible to share one or more portions of one ormore other nodes' source chains. For example, source chain 510 createdby node A may be distributed to one group of selected nodes on Holochain500. Each selected node may retain a local copy of source chain 510. Theselected nodes may be identified according to one or more selectionparameters. For example, the nodes may be chosen according to theirrespective “distances” from node A. The distances may be defined as thenumber of hop(s) in routing a message from node A to a given node, forexample. Further, the nodes may be named based on their uptime such thatthe total sum of uptime of all of the selected nodes may exceed aresilience factor, which is determined based on reliability andavailability requirements of Holochain 500 or HApp 505. Note that thismanner of selection may result in the Holochain network adapting tochanges in topology and a shared DHT redistribution by regulating thenumber of network-wide redundant copies of shared source chains.

When node A pushes new entry to shared DHT 515, a subset from the groupof selected nodes may be picked as validators to perform thesystem-level validation of the new entry. The subset of nodes may bechosen randomly to represent unbiased witnesses. With a successfulvalidation, the new entry may be accepted and allowed to propagate.Otherwise, it may be rejected, and the node initiating the invalid entrymay be held accountable for the fraud. The validation rule may bedefined specifically for each HApp 505. The validation rule may include,for instance, business rules, application logic, restrictions, etc.,which may have different demands for strictness of differentapplications. Further, the validation may change dynamically in responseto the configuration or variation of the applications. Each selectednode may verify the entry shared by node A based on node A's sourcechain 510, confirm the source of data based on A's signature, andvalidate the entry with the system-level validation rule. When aselected node completes all the checks successfully, it may mark thereceived data valid and then add its own signature. The selected nodemay further share the entry, like an initiating node.

Holochain 500 may further provide a mechanism for nodes to shareinformation regarding those who have broken validation rule(s). Thebad-acting nodes may be punished, for example, by being excluded fromparticipation in HApp 505. In particular, nodes may use “gossip” toshare information about their experience of the behavior of other nodes.According to a gossip protocol, each node may maintain a set of metricsabout another node, including a metric “experience” and a metric“confidence” of that experience. The set of metrics may be establishedthrough direct experiences with a given node or based on gossips fromother nodes. The set of metrics may be stored at each node's own privatespace, and shared with other nodes directly as needed. In addition, eachnode may keep a signed declaration (or “warranty”) as for any of the setof metrics, such as the metric experience or metric confidence. Thewarranty may be maintained in a manner similar to that of source chain510. For example, when a node introduces a new metric or alerts anexisting metric, its action(s) on the metric may be footprinted in thewarranty. The warranty may function as a tool for other nodes to makeprovenance-based verifiable claims about a given node in the network.Those claims may be gossiped from one node to another which need to hearabout the claims so as to make decisions about interacting with thegiven node. A node may determine the node to be gossiped with based on ameasurement, for instance, a probabilistic value weighing thatinformation from the given node may change the set of metrics of thenode to be gossiped with. A node may further use its set of metric todetermine a node to be gossiped about. In particular, the metricconfidence may impact the selection of nodes to be gossiped with orabout. A node with high confidence may be one that has first-handexperience with a given node's actions. This node may be allowed togossip about the given node more proactively, for example, by “pushing”a gossip about the given node to other nodes. Conversely, a node withlow confidence may be only allowed to gossip passively through“pulling”—pulling information by other nodes from this node. There maybe various reasons why a node has low confidence about a given node. Forexample, the node may have a unique relationship with a given node to begossiped about, for instance, the node relies on the given node to routemessage. This unique relationship may negatively affect the node'sconfidence with the given node or discourage the node from gossip aboutthe given node.

FIG. 7 shows the operation of an exemplary Holochain application. InFIG. 7, a participant or node of HApp 505—Alice—may write a message(i.e., data) for sharing with other nodes of HApp 505 (block 705). Alicemay cryptographically sign the message with a public-key encryption(block 710). The message, with Alice's signature, may be saved (orcommitted) locally at Alice's private space (block 715). The data, suchas the message, plus Alice's signature, may be reserved into Alice'ssource chain 510 after local validation (block 720). The message, withconcomitant source chain 510, may be shared by Alice with a subset ofselected nodes (block 725). As described, the nodes may be selected asvalidators according to one or more parameters, for instance, theirrespective distances from Alice, their uptime, and a resilience factor.In addition, the validators may be chosen randomly to represent unbiasedwitnesses. Each validator may check the validity of the shared message(block 730). For example, each validator may retain a local copy ofAlice's published source chain 510 and use it to validate the history ofthe message (e.g., the content of the message and editing by Alice). Inaddition, each validator may confirm the provenance of the message(e.g., the message is initiated by Alice) according to Alice'ssignature. Finally, each validator may validate that the message meetsthe system-level validation rule as defined by HApp 505. If any of thechecks fails, the validator may reject the message and mark it“rejected” (block 735). Conversely, if the message passes thevalidation, a validator may accept the message, mark it “valid” and addits own signature (block 740). The validator may take further actions asneeded by HApp 505, for example, adding a link to the message fromAlice's profile (block 745). In addition, the validator may gossip itsexperience about Alice A with other nodes (block 750). As described, thegossip may involve the communication of a set of metrics. Each nodebeing gossiped with may serve as a new validator to continuously verifymessages (block 755), in the way as described above. Note that once avalidator adds its own signature, this validator may be held accountableas well for an invalid message. If the message breaches a validationrule(s), the message may be marked “rejected” and the node(s) sharingthe message may be held liable (block 760). For example, nodes maygossip a warning about a bad-acting node, and the bad-acting node mayfurther be excluded from participation in HApp 505.

In the Holochain network described above, each node is in communicationwith a subset of the other nodes in the network, but as the number ofnodes increases, it becomes impractical for each node to be connectedwith all or even a substantial portion of the available nodes. TheHolochain network may use a relaxed, agent-centric distributed hashtable (RRDHT) structure to organize the nodes as well as performdiscovery for a requested value. According to some embodiments, eachnode in the Holochain network may self-elect its own agent location,store radius and query radius. A node requesting a value may firstexamine the availability of the requested value in its store radiusbased on its agent location, and then expend the inquiry into the queryradius, and so on. According to some embodiments, a node may go througha bootstrapping phase for joining a new Holochain network. The joiningnode may publish its agent location, store radius and query radius untilafter it has expand to a threshold number of nodes within the radiusthat the joining node attempts to store or query. The threshold numbermay be associated with a resilience factor. According to someembodiments, the nodes in the Holochain network may push data to astoring node or pull data from another node through gossiping.

In the following description, for purposes of explanation, numerousspecific details are set forth to provide a thorough understanding ofthe disclosed concepts. As part of this description, some of thisdisclosure's drawings represent structures and devices in block diagramform to avoid obscuring the disclosure. In the interest of clarity, notall features of an actual implementation are described in thisdisclosure. Moreover, the language used in this disclosure has beenprincipally selected for readability and instructional purposes and hasnot necessarily been selected to delineate or circumscribe the fullinventive scope of the disclosed subject matter, which is defined by theappended claims.

Agent Identity, Agent Location, Store Radius and Query Radius

Relaxed, agent-centric distributed hash table (RRDHT) aims at providingquick peer discovery during content addressing in a Holochain network.In RRDHT, nodes may self-elect and publish separate “store radius” and“query radius” values based on an “agent loc” or “agent location” of thenode. The agent locations may represent the individual locations of thenodes in the Holochain network—the Holochain network may discover thenodes based on their agent locations. The agent loc may be any kind ofobjects, such as a number, a string, a symbol, etc. According to someembodiments, the agent loc may be determined based on an identity of thenode (“agent identity”). For example, the identity of the node may beassociated with a public key, for instance a binary number, in acryptographic, digital signature of the human user associated with thenode. Alternatively, the identity of the node may be an objectassociated with the content stored by the node. The term “content” mayrepresent any type of objects, such as a number, a data, a symbol, avalue, a piece of code, a documentation, and so on. Furthermore, theidentity of the node may be a hash, for example, the hash of the publickey, to provide further security. The agent loc of a node may bedetermined based on the agent identity of the node. For example, theagent loc may be an unsigned integer number wrapped to a fixed range,for instance, between 0 and 4,294,967,295 (or FFFFFFFF in hexadecimal).As shown by the Python code below, given that the agent identity of anode is a 32-byte hash, for example, the agent loc of the node may bederived by compressing the binary agent identity into a 4-byte number byapplying an XOR operation to every successive four bytes of the agentidentity.

let hash = b“fake hash fake hash fake hash...”; let mut loc: [u8; 4] =[0; 4]; loc.clone_from_slice(&hash[0..4]); for i in (4..32).step_by(4) {loc[0] {circumflex over ( )}= hash[i]; loc[1] {circumflex over ( )}=hash[i + 1]; loc[2] {circumflex over ( )}= hash[i + 2]; loc[3]{circumflex over ( )}= hash[i + 3]; }

Discovery in Holochain Network According to RRDHT

Given a requested value, one primary goal of RRDHT is for a random nodeto be able to find the appropriate node that stores and accordinglyretrieve the requested value. This discovery process can be explainedwith reference to FIG. 8. For ease of illustration, only 8 nodes (805,810, 815, 820, 825, 830, 835 and 840) are depicted in exemplaryHolochain network 800. In this specific example, because the agentlocations of the nodes are defined as integers wrapped to a fixed range,Holochain network 800 may be represented by a ring. Moreover, nodes 805,810, 815, 820, 825, 830, 835 and 840 may reside along the ring with evenor unequal distances from each other as shown in FIG. 8.

Node 805 (“requesting node”) may request a value which is stored at node825 (“target node”). Initially, node 805 may not know that node 825stores the requested value, nor does node 805 may know the address ofnode 825. In a further extreme scenario, node 805 may never establish aprior connection with node 825—node 805 may not know node 825 exists inHolochain network 800 at all. The term “connection” may indicate anetworking communication in any type of manner, for example, through aland telephone network, a wired network, a wireless network, a mobilenetwork, a satellite network, or a combination of the above, etc.

The discovery of node 825 by node 805 may be performed based on thestore radius and query radius of node 805 as well as the agent locationsof the nodes in Holochain network 800. The store radius may correspondto a bucket of peer nodes, within agent storage arc 865, whose storagecontent the requesting node may have knowledge about. According to someembodiments, it may be preferential to place the bucket of peer nodesclose to the requesting node thus reducing the hops in discovery. Thismay associate the store radius with the agent locations of the nodes inthe Holochain network. For example, if the agent loc of a node is 42, astore radius of 2 may indicate a bucket of peer nodes with agentlocations in the range of 40-44. Accordingly, a store radius of zero mayrepresent the node itself. Referring to FIG. 8, a store radius of 1 ofnode 805 may indicate a bucket of peer nodes, such as node 810 and 840,which may reside within the distance of the store radius surrounding therequesting node. Moreover, node 805 may have knowledge about the storagecontent of nodes 810 and 840 within the store radius.

Node 805 may also have a query radius. The query radius may indicate abucket of nodes (“a bucket of references”), within agent storage arc870, with which the requesting node may have connections—the addressesof the bucket of nodes in the query radius have been known to therequesting node. Therefore, the query radius of a node may always beequal to, or greater than, the store radius of the node. Referring toFIG. 8, the query radius of node 805 may produce two references (besidesnodes 810 and 840 in the store radius)—nodes 815 and 835—whose addressesmay have been known to node 805. Unlike nodes 810 and 840 in the storeradius, node 805 may not have information about the content stored bynodes 815 and 835. Instead, node 805 may merely know the existence ofnodes 815 and 835 exist in Holochain network 800 and have theiraddresses. The term “address” may refer to any type of addressesaccording to a networking protocol, for example, point-to-point protocol(PPP), user datagram protocol (UDP), transmission controlprotocol/Internet protocol (TCP/IP), etc.

Node 805 may perform the discovery as the following to retrieve therequested value from node 825. First, node 805 may examine, as shown byarrows 845 and 850, whether the requested value is available in itsstore radius—whether the requested value is stored at nodes 810 or840—because node 805 may already have knowledge about the storagecontent of nodes 810 and 840. The examination of nodes 810 and 840 maybe carried out in order or in parallel. If the requested value isavailable in the store radius, the storing node may return the requestedvalue, and the discovery may terminate.

Conversely, if the requested value is not available in the store radius,node 805 may further the discovery to the bucket of nodes in the queryradius, such as nodes 815 and 835. Because node 805 maintains theaddresses indexing of nodes 815 and 835, node 805 may be able tocommunicate with nodes 805 and 835 and inquire whether they include therequested value. According to some embodiments, node 805 may inquire thenode in the query radius which has a closest distance to the target node825. The distance may be measured according to the agent locations ofthe nodes, which, in turn, may be associated with the storage content ofeach individual nodes, as described above. This way, RRDHT may associatethe requested value with agent locations in a manner analogous to therelationship between a value/key pair in a hash table. In FIG. 8, node805 may have two nodes 815 and 835, in the query radius. Between thesetwo references, node 835 may have a closest distance to target node 825.Thus, node 805 may inquire node 835, as shown by arrow 855, about theavailability of the requested value. If node 835 stores the requestedvalue, node 835 may return the requested value, and the discovery mayterminate.

Conversely, if the requested value is not available in the query radius,the foregoing discovery may be repeated around a new center at node 835.For example, node 835 may also have a store radius and a query radius.The store radius may indicate a bucket of nodes whose storage contentnode 835 may have knowledge about, while the query radius may correspondto a bucket of nodes with which node 835 may have connections. Node 835may continue the discovery by first examining its store radius and thenexpand to the query radius, and so on. In this specific example in FIG.8, target node 825 may reside within the store radius of node 835. Thus,in response to the examination of node 835, as shown by arrow 860, node825 may return the requested value to node 835 which may further forwardthe requested value to node 805, and the discovery may end.

FIG. 9 illustrate an exemplary discovery process 900 in a Holochainnetwork. The requesting node may start from a requesting node lookingfor a requested value (block 905). The requesting node may first examinewhether the requested value is stored by any of peer nodes in the storeradius based on the agent loc of the requesting node (blocks 910 and915). If the requested value is available in the store radius, thestoring node may return the requested value to the requesting node(block 920), and the requesting node may terminate the discovery (block925). Conversely, if the requested value is not available, therequesting node may expand its search to the peer nodes in the queryradius (block 930). The requesting node may inquire whether therequested value is stored by any of the peer nodes in the query radius(block 935). According to some embodiments, the requesting node mayinquire the node (“inquired node”) in the query radius that has aclosest distance to the target node. The distance may be measured basedon the agent locations of the nodes. If the requested value is stored inthe query radius, the storing node may return the requested value (block920) and the discovery may end (block 925). Conversely, if the requestedvalue is not available in the query radius, the discovery may shift thecenter to the inquired node (block 940). The inquired node may continuethe discovery by repeating the foregoing searching process.

According to some embodiments, requesting node 805 may choose to keepreferences to a certain number of additional nodes outside the queryradius, for example, node 410 in FIG. 4. When a node discovers such areference, it will decide whether the node should be kept in favor ofexisting references. For example, the node may give a preference tocloser nodes. This algorithm gives preference to closer nodes, and couldbe something like the following:

-   -   Given the loc space remaining outside the query radius    -   Call a 34% sized zone exactly in the center zone “X3”    -   Call two adjacent 22% sized zones “X2A” and “X2B”    -   Call the remaining two 11% sized zones “X1A” and “X1B”

Nodes will track up to 2 peers in each zone. If they already have twopeers, a quality algorithm will decide which to keep based onresponsiveness, size of store, query radii, and other metrics. Imagine aworst-case scenario: a DHT network with 4 billion nodes. The networkstores so much data that all nodes choose to only index a radius of 1and keep a query radius of 2. A worst-case query should be O(logn)/roughly 22 hops.

But individual node references do not take up that much memory space, sonodes could, in fact, store a great deal more references than the abovealgorithm, and publish a much wider query radius than 2. These factorsgreatly reduce the number of hops to query. In most real-worldapplications, it should be trivial to achieve full query radiuscoverage, thus reducing the hops for any query to 1.

Bootstrapping

A node that would like to join a Holochain network may first go througha bootstrap process. During bootstrapping, the joining node may need toknow the address of at least another node—a bootstrap node—that isalready participating in the Holochain network. Upon joining theHolochain network, the joining node may reset its address indexing,store radius and query radius to zero. The joining node may notself-elect any radii without first knowing that it may see a thresholdnumber of nodes within the radius that the joining node attempts tostore or query. According to some embodiments, the threshold may beassociated with a resilience factor (“R”) which represent a level ofavailability in case one of more of the nodes within the radius becomeoffline. For example, if the resilience factor is 25, the joining nodemay not publish either a store or query radius greater than zero untilafter the joining node has expended enough such that there are 25 peernodes reside within the radius that the joining node attempts topublish.

Publishing Date and Gossip

Push

In a Holochain network, publishing data may require a node (“publishingnode”) communicating with a peer node which claims responsibility forstoring that data. The publishing node may then push that data to thestoring node in an exponential manner, for example, using a protocolwith low overhead such as UDP. The publishing node may already know whatpeer nodes should be storing the data because those peer nodes are inthe bucket within its store radius. According to some embodiments,depending on the networking protocol of the Holochain network, it may bepreferred to publish the data to more than one peer nodes to achievebetter reliability and availability. Further, the publishing node mayre-publish the data periodically or when the date receives a new update.

Pull

After a node is initially synchronizing to the network to achieve astore radius, the node may need to continuously maintain consistencyafterwards. The node may gossip with other peer nodes which overlap, atleast partially, the same store radius. The nodes may compare thestorage content with and pull data from, as needed, each other to remainthe synchronization and data consistency.

The various embodiments described above are provided by way ofillustration only and should not be constructed to limit the scope ofthe disclosure. Various modifications and changes can be made to theprinciples and embodiments herein without departing from the scope ofthe disclosure and without departing from the scope of the claims.

What is claimed is:
 1. A system for coordinating distributedcomputation, the system comprising: a plurality of nodes, each nodeincluding a processing element, a network interface, and a memory, theplurality of nodes communicatively coupled together via a network; akeyspace defined across the plurality of nodes, the keyspace having asimple closed shape with a number of dimensions; wherein each node ofthe plurality of nodes has a location in the keyspace as defined by ahash function mapping inputs to points in the keyspace, and a locationin the network; wherein a first node has a first store radius, the firststore radius describing a closed shape in the keyspace associated withthe location of the node in the keyspace, the first store radius havingone fewer dimension than the number of dimensions in the keyspace, andwherein the memory in the first node stores information at memorylocations associated with keyspace locations within the first storeradius; wherein first node has a first query radius, the first queryradius describing a closed shape in the keyspace associated with thelocation of the node in the keyspace, the first query radius having onefewer dimensions than the number of dimensions in the keyspace, whereinthe first query radius is larger than the first store radius; wherein afirst subset of the nodes from the plurality of nodes have keyspacelocations within the first query radius, and the first node stores thenetwork location of the first subset of the nodes, each of the nodes inthe first subset of the nodes having a secondary store radius and asecondary query radius; wherein the processing element of each node isoperable to respond to a request for information stored at an arbitrarylocation in the keyspace by: if the requested information has a keyspacelocation within the store radius, returning the value of the informationfrom the first node; if the requested information has a keyspacelocation outside the store radius but inside the query radius, querying,via the network, a second node from the first subset of the nodes withinthe query radius and returning the value of the information returnedfrom the second node with a secondary store radius encompassing therequested keyspace location; returning a network location referral to athird node, wherein the keyspace location of the third node has a lowerdistance from the keyspace location of the requested information thanthe keyspace location of the first node.
 2. The system of claim 1wherein the processing element of each node is operable to respond tothe request for information by one of responding with informationretrieved from an associated memory location in a node; responding withthe output of a calculation; and responding with the output of acalculation, wherein one of the inputs to the calculation was retrievedfrom a memory location in a node.
 3. The system of claim 2 wherein thekeyspace forms a two-dimensional circle.
 4. The system of claim 2wherein the keyspace is non-Euclidean.
 5. The system of claim 2 whereinthe location of the first node in the keyspace is inside the storeradius of the first node.
 6. The system of claim 2 wherein the locationof the first node in the keyspace is inside the query radius of thefirst node.
 7. The system of claim 2 wherein the first node furtherstores the network location of a second subset of the nodes, whereineach of the nodes in the second subset of the nodes has a keyspacelocation outside the first query radius, and each of the nodes in thesecond subset having a tertiary store radius and a tertiary queryradius.
 8. The system of claim 7 wherein none of the tertiary queryradii overlap with the first query radius.
 9. The system of claim 7wherein the maximum number of nodes in the second subset of the nodes iscapped.
 10. A method for coordinating distributed computation, themethod comprising: communicatively coupling a plurality of nodes via anetwork, each node including a processing element, a network interface,a network location, and a memory; defining a keyspace across theplurality of nodes, the keyspace having a simple closed shape with anumber of dimensions; assigning each node of the plurality of nodes akeyspace location, a store radius, and a query radius; each keyspacelocation being defined by a hash function mapping inputs to points inthe keyspace; each store radius describing a closed shape in thekeyspace having one fewer dimension than the number of dimensions in thekeyspace; each query radius describing a closed shape in the keyspacehaving one fewer dimension than the number of dimensions in thekeyspace, where the query radius is greater than the store radius;receiving a request at a first node, the request being associated with akeyspace location; if the requested information has a keyspace locationwithin the store radius of the first node, responding from the firstnode; if the requested information has a keyspace location outside thestore radius of the first node but inside the query radius of the firstnode, querying, via the network, a second node from the first subset ofthe nodes within the query radius and returning the response receivedfrom the second node; or returning a network location referral to athird node, wherein the distance from the keyspace location of the thirdnode to the keyspace location associated with the request is less thanthe distance from the keyspace location of the first node to thekeyspace location associated with the request.
 11. The method of claim10 wherein returning a response includes one of responding withinformation retrieved from a memory location associated with a node;responding with the output of a calculation; and responding with theoutput of a calculation, wherein one of the inputs to the calculationwas retrieved from a memory location in a node.
 12. The method of claim11 wherein the keyspace location of each node is contained within thestore radius of the same node.
 13. The method of claim 11 wherein thestore radius of each node is located within the query radius of the samenode.
 14. The method of claim 11 wherein the keyspace forms atwo-dimensional circle.
 15. The method of claim 11 wherein the keyspaceis non-Euclidean.
 16. The method of claim 11 wherein the third node hasa keyspace location outside the query radius of the first node.
 17. Anode in a distributed processing system, the node comprising: aprocessing element, a network interface, a network location, a firstkeyspace location, and a memory, wherein the processing element isoperable to: compute a requested location within a multidimensionalkeyspace corresponding to a distributed hash table; store and retrieveinformation corresponding to a first closed area within the keyspace inthe memory; store and retrieve information corresponding to a secondclosed area within the keyspace in the memory; receive a request via thenetwork interface, the request being associated with a keyspacelocation; if the request keyspace location is within the first closedarea within the keyspace, responding to the request using theinformation retrieved from the memory corresponding to the requestkeyspace location; if the request keyspace location is within the secondclosed area within the keyspace, forwarding the request to a networklocation retrieved from the memory corresponding to the request keyspacelocation; or returning a network location referral, wherein the networklocation referral target is closer to the request keyspace location thanfirst keyspace location.
 18. The node of claim 17 wherein responding tothe request using the information retrieved from the memorycorresponding to the request keyspace location includes one ofresponding with information retrieved from the memory; responding withthe output of a calculation; and responding with the output of acalculation, wherein one of the inputs to the calculation was retrievedfrom the memory.
 19. The node of claim 18 wherein the keyspace locationof the node is contained within the first closed area within thekeyspace.
 20. The node of claim 19 wherein the first closed area withinthe keyspace is contained within the second closed area within thekeyspace.